/*
 * kjgetopt.h
 * KJ's simplified stream archiver (kjssar)
 * 
 * (C)Copyright 2013-2015 by Klaus-J. Wolf, kj (at) seismic (dot) de
 * This file is licensed under the General Public License Version 2.
 * http://www.gnu.org/licenses/gpl-2.0.html
 * 
 * This is a proof-of-concept implementation.
 * 
 */


struct CLOption
{
    int   id;
    int   parmflag;
    int   addup;
    char  shortoption;
    char *longoption;
    char *explanation;
};


struct CLOConfig
{
    struct CLOConfig *nxt;
    
    int   id;
    int   flag;
    int   multi;
    char *val;
};


typedef struct CLOConfig *cloconfig_t;


extern const char *kjparseopt_errmsg;
extern int kjparseopt_errnum;
extern int kjparseopt_terminate_on_parm;


cloconfig_t kjparseopts_f(int argc, char * const argv[], struct CLOption *opts, int optslen, void (*cb_doparm)(cloconfig_t,const char *), int *newargp);

int kjgetoptflag(cloconfig_t cfg, int id);

const char *kjgetoptparm(cloconfig_t cfg, int id, char sep);

void kjdestroykjopts(cloconfig_t cfg);

void kjdisplayhelp(struct CLOption *opts, int optslen, FILE *f);
